{% extends "base.html" %}

{% block title %}{{ post.title }} - 我的博客{% endblock %}

{% block content %}
<div class="max-w-4xl mx-auto">
    <article class="bg-white rounded-lg shadow-sm p-8">
        <header class="mb-6">
            <h1 class="text-3xl font-bold text-gray-800 mb-4">{{ post.title }}</h1>
            
            <div class="flex items-center text-sm text-gray-500">
                <span>发布于 {{ post.created_at[:10] }}</span>
                {% if post.updated_at != post.created_at %}
                <span class="mx-2">•</span>
                <span>更新于 {{ post.updated_at[:10] }}</span>
                {% endif %}
                
                {% if post.tags %}
                <span class="mx-2">•</span>
                <div class="flex gap-2">
                    {% for tag in post.tags %}
                    <a href="{{ url_for('index', tag=tag) }}" 
                       class="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs hover:bg-blue-200">
                        {{ tag }}
                    </a>
                    {% endfor %}
                </div>
                {% endif %}
            </div>
        </header>
        
        <div class="prose prose-lg max-w-none">
            {{ post.content_html|safe }}
        </div>
        
        <footer class="mt-8 pt-6 border-t">
            <div class="flex justify-between items-center">
                <a href="{{ url_for('index') }}" class="text-blue-600 hover:text-blue-800">
                    ← 返回列表
                </a>
                
                <div class="space-x-4">
                    <a href="{{ url_for('edit_post', post_id=post.id) }}" 
                       class="text-gray-600 hover:text-gray-800">
                        编辑
                    </a>
                </div>
            </div>
        </footer>
    </article>
</div>
{% endblock %}
